import { request } from "@/utils/request"

const prefix = '/cars'
interface addCarsParams {
	uid: number
	number: string
	position: number
	picture: string
}
/**
 * 添加车辆
 * @param params 
 * @returns 
 */
export const addCarsRequest = (params: addCarsParams) => {
	return request.post(`${prefix}/addCars`, params)
}

/**
 * 获取车辆
 * @returns 
 */
export const getCarsRequest = () => {
	return request.get(`${prefix}/getCars`)
}

/**
 * 删除车辆
 * @param params 
 * @returns 
 */
export const deleteCarsRequest = (params: number) => {
	return request.delete(`${prefix}/deleteCars/${params}`)
}

interface reviseCarsParams {
	picture: string
	number: string
	uid: number
	storey: number
	x: number
	y: number
}
/**
 * 修改车辆
 * @param params 
 * @returns 
 */
export const reviseCarsRequest = (params: reviseCarsParams) => {
	return request.put(`${prefix}/reviseCars`, params)
}

/**
 * 根据车位id查询车辆
 * @param params 
 * @returns 
 */
export const searchCarRequest = (params: number) => {
	return request.get(`${prefix}/searchCar/${params}`)
}